
#include "S_36_IndicatorLight_doGet.h"
#include "mi_iid_define.h"
#include "property_decoder.h"
#include "section_define.h"
#include "main.h"


/**
 * 格式: property_value_new_boolean(true 或 false)　
 * 取值: true 或　false
 */
static void P_36_1_On_doGet(property_operation_t *o)
{
	InDoorBusReg RegSection1 = {0};
#if 	PROPERTY_TYPE
	RegSection1.V8 = GetPbsRegValue(0x85);
//	if(RegSection1.BIT.bit1)
	{
		property_value_new_boolean(&o->value,RegSection1.BIT.bit0);
	}
	
#else	
	o->value.format = PROPERTY_FORMAT_BOOLEAN;
    o->value.data.boolean.value = true;  // TODO: 这里需要读到属性真正的值
#endif
    
}

/**
 * 格式: property_value_new_integer(整数)　
 * 取值: 0(Auto), 1(Medium), 2(High)
 */
static void P_36_2_Brightness_doGet(property_operation_t *o)
{
	InDoorBusReg RegSection1 = {0};
#if 	PROPERTY_TYPE
	RegSection1.V8 = GetPbsRegValue(0x86);
//	if(RegSection1.BIT1.bit7)
	{
		property_value_new_integer(&o->value,RegSection1.BIT1.bit0_6);
	}
	
#else	
	o->value.format = PROPERTY_FORMAT_NUMBER;
	o->value.data.number.type = DATA_NUMBER_INTEGER;
	o->value.data.number.value.integerValue = 2;// TODO: 这里需要读到属性真正的值
#endif
}

void S_36_IndicatorLight_doGet(property_operation_t *o)
{
    switch (o->piid)
    {
        case PIID_36_1_On:
            P_36_1_On_doGet(o);
            break;

        case PIID_36_2_Brightness:
            P_36_2_Brightness_doGet(o);
            break;

        default:
            o->code = OPERATION_ERROR_VALUE;
            break;
    }
}
